/*
 * Copyright (c) 2020, 2023, keyila All rights reserved.
 *
 */
package com.clp.study.designPattern.templatePattern.prod;


import com.clp.bean.Result;
import com.clp.bean.ResultCode;

/**
 * @author clp
 * @version 1.0
 */
public class ApiTemplate {

    public void execute(Result result, final Action action){
        try {
            action.validate();
            action.execute();
            action.after();
            result.setSuccess(true);
            result.setCode(1024);
        }catch (Exception e){
            result.setSuccess(false);
            result.setCode(ResultCode.ERROR);
        }
    }
}
